//获取权限公司信息
import _Api from "@/api";
import constant from "@/public/constant";

export default{
	getAuthInfo(){
		var obj = {};
//      var that = this;
        if (constant.user.userTypeId == 4) {
            obj.account = constant.user.userName;
            obj.userType = 2;
        } else if (constant.user.userTypeId == 1) {
            obj.account = constant.user.oaNum;
            obj.userType = 1;
        }
        return new Promise((resolve, reject)=>{
        	_Api.getAuthInfo(obj).then(function(response){
        		var data = response.data;
        		if(data.code == "1"){
                    if(Array.isArray(data.rows.myMstCompany)&&data.rows.myMstCompany.length>0){
                        resolve(data.rows.myMstCompany);
                    } else{
                        reject("客户数据为空！");
                    }
        		}else{
        			reject("获取权限公司信息失败！");
        		}
        	}).catch((err)=>{
        		reject(err.data.message);
        	})
        })
	}
}